<!DOCTYPE html>
<html>
<head>
    <title>地址列表</title>
    <include file='public/head'>
	<style>
		.layui-legend-size{font-size:14px !important;}
		.layui-nopadding{padding:0 !important;}
		.layui-overflow{overflow:auto;}
		.layui-nomargin{margin: 0 !important;}
		.layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
		.layui-input{height:30px !important; }
		.layui-form-search-item .layui-inline{margin-bottom: 5px;} 
		.layui-form-search-item label{margin-left: 15px;}
		.layui-table-page {padding: 7px 0px 0px;}
		.layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
	</style>
</head>
<body>
<!-- layui-tab开始 -->
<div class="layui-tab " lay-filter="demo-tab">
	<!-- 顶部导航菜单开始 -->
	<div class="layui-tab-nav" >
        <ul class="layui-tab-title">
			{:getNav('address','admin_index/index')};
		</ul>
	</div>
	<!-- 表格内容开始 -->
	<div class="layui-card" style="margin-top:20px">
		<div class="layui-card-header layui-bg-gray layui-bottom" id="piliang">
			<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal update-btn" ><i class="layui-icon">&#xe67d;</i>更新地图库</a>
		</div>
		<div class="layui-card-body layui-nopadding " >
			<table  class="layui-table layui-nomargin" >
				<thead>
					<tr>
						<th>地区名称</th>
						<th>地区描述</th>
						<th>是否显示</th>
						<th>操作</th>	
					</tr>
				</thead>
				<tbody>
						<tr>
							<td>中国</td>
							<td></td>
							<td>
								<a href="javascript:void(0);" style="text-decoration:none;color:green;">√</a>
							</td>
							<td>
								<div class="layui-btn-group">
									<a class="layui-btn layui-btn-xs"  href="{:cmf_plugin_url('Address://admin_index/subord')}">查看下级地区</a>
								</div>
							</td>
						</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>
<!-- layui-tab结束-->
<include file='public/scripts'>
</body>

<script type="text/javascript">


$('.update-btn').on('click', function(){
	let url = "{:cmf_plugin_url('Address://admin_index/updateAddress')}";
	var text = "确定要更新吗？";
	layer.confirm(text, {icon: 3, title:'提示', btn: ['确定','取消']}, function(index,layero){
		// layer.load();
        $.ajax({
            url:url,
            type:'post',
            success:function(data){
				if (data.code == 1) {
					layer.msg(data.msg,{icon:1,time:1500},function(){
						window.location.reload();
						// layer.closeAll(index);
					});
				} else {
					layer.msg(data.msg,{icon:2,time:1500}, function(){
						// layer.closeAll(index);
					});
				}


            },
            error:function(){
                layer.msg('系统错误',{icon:2,time:1500});
            }
        })
	},function(index){
	    // alert('取消');
	});
})
	


</script>


</html>